j3deditor.bin.hierarchy
Class J3DeShape3D

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.J3DeObject
          extended by j3deditor.bin.hierarchy.J3DeShape3D
All Implemented Interfaces:
Copyable, Cuttable, Deletable

public class J3DeShape3D
extends J3DeObject

Contains and manages an instance of javax.media.j3d.Shape3D.

Author:
Risto Seene
See Also:
Shape3D

Constructor Summary
J3DeShape3D()
          Creates an empty J3DeShape3D object.
J3DeShape3D(javax.media.j3d.Shape3D object)
          Creates an instance of J3DeShape3D that contains the given Shape3D object.
J3DeShape3D(Shape3DType type)
          Creates an instance of J3DeShape3D with the given type.
 
Method Summary
 void addGeometry(J3DeGeometry g)
          Adds new geometry.
 HierarchyNode clone(HierarchyNode node)
          Clones this node.
 J3DeAppearance getAppearance()
          Returns the appearance object of this node.
 HierarchyNode getChild(int index)
          Returns the child at the specified index.
 javax.media.j3d.Geometry[] getGeometries()
          Returns all geometries which are referenced by this Shape3D.
 int getIndexOfChild(HierarchyNode child)
          Returns the index of specified child.
 int getNumberOfChildren()
          Returns the number of children.
 void init3DObject(javax.media.j3d.Node obj)
          Applies the given Node object to this node.
 void recalculateNormals(double greaseAngle)
          Generates normals using NormalGenerator.
 void setGeometry(J3DeGeometry g, int index)
          Replaces geometry at the specified index.
 
Methods inherited from class j3deditor.bin.hierarchy.J3DeObject
delete, get3DObject, getObject, getRotationZ, getRotationX, getRotationY, getScaleZ, getScaleX, getScaleY, getTranslationZ, getTranslationX, getTranslationY, initObject, rotate, rotateZ, rotateX, rotateY, scale, scaleAll, scaleZ, scaleX, scaleY, setNode, setObject, translate, translateZ, translateX, translateY
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
equals, getIndex, getParent, getParent, getType, hasNamedChild, removeChild, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J3DeShape3D

public J3DeShape3D()
Creates an empty J3DeShape3D object. Requires initialization with init3DObject() method


J3DeShape3D

public J3DeShape3D(Shape3DType type)
Creates an instance of J3DeShape3D with the given type.

Parameters:
type - the type of the object

J3DeShape3D

public J3DeShape3D(javax.media.j3d.Shape3D object)
Creates an instance of J3DeShape3D that contains the given Shape3D object.

Parameters:
object - the object that will be applied to this node
Method Detail

init3DObject

public void init3DObject(javax.media.j3d.Node obj)
Applies the given Node object to this node.

Parameters:
obj - object to be applied to this node

clone

public HierarchyNode clone(HierarchyNode node)
Clones this node.

Overrides:
clone in class J3DeObject
Parameters:
node - object sent by subclass, otherwise null
Returns:
Returns the clone of this node

getChild

public HierarchyNode getChild(int index)
Returns the child at the specified index.

Overrides:
getChild in class HierarchyNode
Parameters:
index - index of child
Returns:
Returns the child with the specified index

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of children.

Overrides:
getNumberOfChildren in class HierarchyNode
Returns:
Returns the number of children as integer

getIndexOfChild

public int getIndexOfChild(HierarchyNode child)
Returns the index of specified child.

Overrides:
getIndexOfChild in class HierarchyNode
Parameters:
child - child node which index will be returned
Returns:
Returns the index of specified child

getAppearance

public J3DeAppearance getAppearance()
Returns the appearance object of this node.

Returns:
Returns the appearance object of this node

getGeometries

public javax.media.j3d.Geometry[] getGeometries()
Returns all geometries which are referenced by this Shape3D.

Returns:
all geometries which are referenced by this Shape3D

setGeometry

public void setGeometry(J3DeGeometry g,
                        int index)
Replaces geometry at the specified index.

Parameters:
g - new geometry
index - index of geometry

addGeometry

public void addGeometry(J3DeGeometry g)
Adds new geometry.

Parameters:
g - new geometry

recalculateNormals

public void recalculateNormals(double greaseAngle)
Generates normals using NormalGenerator.

Parameters:
greaseAngle - grease angle in degrees
See Also:
NormalGenerator.generateNormals(GeometryInfo geom)